namespace NGridDrawer.Partitions
{
    /// <LastUpdate author="Blaise Braye" Date="15/06/2008 17:01"/>
    /// <summary>
    /// Represents a column in a <see cref="PartitionGrid"/> object
    /// </summary>
    public class PartitionColumn : PartitionGridElement
    {
        private readonly int _firstColum;
        private readonly int _lastColumn;
        private readonly float _width;


        /// <summary>
        /// 	<para>Initializes an instance of the <see cref="PartitionColumn"/> class.</para>
        /// </summary>
        /// <param name="grid"><see cref="PartitionGrid"/> object associated with this element</param>
        /// <param name="ordinal">Ordinal number of this partitionColumn</param>
        /// <param name="firstColumn">First column of the source data grid which belongs to this partitionColumn</param>
        /// <param name="lastColumn">Last column of the source data grid which belongs to this partitionColumn</param>
        /// <param name="width">Width of the partitionColumn</param>
        public PartitionColumn(PartitionGrid grid, int ordinal, int firstColumn, int lastColumn, float width)
            : base(grid)
        {
            Ordinal = ordinal;
            _firstColum = firstColumn;
            _lastColumn = lastColumn;
            _width = width;
        }

        /// <summary>
        /// Gets the first column of the source data grid which belongs to this partitionColumn
        /// </summary>
        public int FirstColumn
        {
            get { return _firstColum; }
        }

        /// <summary>
        /// Gets the last column of the source data grid which belongs to this partitionColumn
        /// </summary>
        public int LastColumn
        {
            get { return _lastColumn; }
        }


        /// <summary>
        /// Gets the width of the partitionColumn
        /// </summary>
        public float Width
        {
            get { return _width; }
        }


        /// <summary>
        /// Gets the total number of the data grid columns belonging to the partitionColumn
        /// </summary>
        public int ColumnCount
        {
            get { return 1 + LastColumn - FirstColumn; }
        }

        /// <summary>Get Ordinal Property</summary>
        public int Ordinal { get; private set; }
    }
}